package com.fafa.tankgame05;

/**
 * 坦克类
 */
public class Tank {
    private int x;
    private int y;

    private int direct = 0;
    private int speed = 5;

    boolean isLive = true;

    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getDirect() {
        return direct;
    }

    public void setDirect(int direct) {
        this.direct = direct;
    }

    public void moveUp() {
        if (y >= 0)
            y -= speed;
    }

    public void moveDown() {
        if (y < 750 - 120)
            y += speed;
    }

    public void moveLeft() {
        if (x >= 0)
            x -= speed;
    }

    public void moveRight() {
        if (x < 1000 - 60)
            x += speed;
    }
}


